package com.lxy.skill.controller;

import com.sun.org.apache.xpath.internal.operations.Bool;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @Author lxy
 * @Date 2021/12/11 18:22
 * @Description
 */
@RestController
@Slf4j
public class ConsumerController {

    public static final String PAYMENT_URL = "http://SECKILL-SERVER";
    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("/seckill/{sid}/{uid}")
    public boolean skill(@PathVariable("sid") String sid, @PathVariable("uid") String uid){
        return restTemplate.getForObject(PAYMENT_URL+"/seckill/"+sid+"/"+uid,Boolean.class);
    }
}
